package cn.xd.itstack.springframework.context.support;

import cn.xd.itstack.springframework.beans.factory.XmlBeanDefinitionReader;
import cn.xd.itstack.springframework.beans.factory.support.DefaultListableBeanFactory;

/**
 * @Classname AbstractXmlApplicatonContext
 * @Description TODO
 * @Date 2022/5/18 上午10:49
 * @Created by lvxiaodong
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {


    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory){
        XmlBeanDefinitionReader xmlBeanDefinitionReader =new XmlBeanDefinitionReader(beanFactory,this);
        String[] configLocations = getConfigLocations();
        if(configLocations!=null){
            xmlBeanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    /**
     * 获取配置文件路径
     * @return
     */
    protected abstract String[] getConfigLocations();
}
